// openid.js

function OpenID(id, url, use, servers) {
	this._id = id;
	this._url = url;
	this._use = use;
	this._servers = servers;
	this._isDefault = false;
}

OpenID.prototype.getID = function() {
	return this._id;
}

OpenID.prototype.getURL = function() {
	return this._url;
}

OpenID.prototype.getDisplayURL = function() {
	var idx = this._url.indexOf("//");
	return this._url.substring(idx + 2);
}

OpenID.prototype.getUse = function() {
	return this._use;
}

OpenID.prototype.getServers = function() {
	return this._servers;
}

OpenID.prototype.compareServer = function(server) {
	var result = false;
	for (var i = 0; i < this._servers.length; i++) {
		if(server.indexOf(this._servers[i]) == 0) {
			result = true;
			break;
		}
	}
	return result;
};

OpenID.prototype.isDefault = function() {
	return this._isDefault;
}

OpenID.prototype.addServer = function(server) {
	this._servers.push(server);
}

OpenID.prototype.setIsDefault = function(bool) {
	this._isDefault = bool;
}
